// VZ 2012.04.06 - moved the localization code of GroupingText property from Render to the overridden property.

using System.Web.UI;

using OpenNetCommerce.Localization;

[assembly: TagPrefix("MettleSystems.dashCommerce.Controls", "dashCommerce")]
namespace MettleSystems.dashCommerce.Controls
{

	[ToolboxData("<{0}:Panel ID=\"PanelId\" runat=\"server\" />")]
	public class Panel : System.Web.UI.WebControls.Panel
	{

		/// <summary>
		/// Gets or sets the localized caption for the group of controls that is contained in the panel control.
		/// </summary>
		public override string GroupingText
		{
			get
			{
				if (DesignMode)
					return "[:" + base.GroupingText + ":]";
				if (!string.IsNullOrEmpty(this.ID) && string.IsNullOrWhiteSpace(base.GroupingText)) {
					return LocalizationUtility.GetText(this.ID);
				}
				//else
				return base.GroupingText;
			}
			set
			{
				base.GroupingText = value;
			}
		}

		//protected override void Render(HtmlTextWriter writer)
		//{
		//   if (!string.IsNullOrEmpty(this.ID) && this.GroupingText.Length == 0) {
		//      this.GroupingText = LocalizationUtility.GetText(this.ID);
		//   }
		//   base.Render(writer);
		//}

	}
}